// 与main有点不同,main传函数,但效果是相同的。支持两种函数式与对象形式
module.exports = {
    sync: function( tasks ){
        
        var op = [];
        if( Array.isArray( tasks ) ){
            
            tasks.forEach(function( item ){
                op.push( new Promise( (resolve, reject)=>item.call({resolve: resolve, reject: reject}) ) );
            })
            
        }else{
            
            op.push( new Promise( (resolve, reject)=>tasks.call({resolve: resolve, reject: reject}) ) );
        
        }
        
        return Promise.all( op );
        
    }
}